from django.urls import path, include
from drf_test.snippets import views
from rest_framework.urlpatterns import format_suffix_patterns

# 1基于函数的视图的路由
"""
urlpatterns = [
    path('snippets/', views.snippet_list),
    path('snippets/<int:pk>', views.snippet_detail),

]

urlpatterns = format_suffix_patterns(urlpatterns)
"""

urlpatterns = [
    path("snippets/", views.SnippetList.as_view()),
    path('snippets/<int:pk>', views.SnippetDetail.as_view()),
    path("users/", views.UserList.as_view()),
    path("users/<int:pk>", views.UserDetail.as_view())
]

urlpatterns += [
    path('api-auth/', include('rest_framework.urls'))
]

urlpatterns = format_suffix_patterns(urlpatterns=urlpatterns)

